package com.angular.back.service;


import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.angular.back.dao.UserRepository;
import com.angular.back.entity.User;

@Service("userService")
public class UserServive {
	@Autowired
	UserRepository userRepository;
	
	public void addUser(User user) {	
		userRepository.save(user);
	}
	
	public void delUser(Long id) {	
		userRepository.delete(id);
	}
	
	public User getOneUser(Long id) {	
		return userRepository.findOne(id);
	}
	
	public List<User> getUsers() {
		return userRepository.findAll();
	}
}
